#include "DumpLog.h"
#include "ParseParam.h"
int main(int argNum, char **args)
{
    using namespace Parse;

    //1.定义需要解析的参数,解析的结果将赋值到这些参数上
    double  fa(1.5);
    int32_t fn(168);
    std::string s1(""), s2("");

    /*
    2.这里申明参数. 测试时可以输入如下命令测试结果:
    ./testParseParam -a 2.3
    ./testParseParam -a 2.3 -b 45
    ./testParseParam -a 2.3 -b 45 -ws s2s2 -s bbb
    */
    vecParseParam_t params
    {
        ParseParam_t("fa" , "a", true,  ParamType_E::Double_E, &fa, "一个双精度参数,需要用户输入"),
        ParseParam_t("fn" , "b", true,  ParamType_E::Int32_E,  &fn, "一个整型参数,需要用户输入"),
        ParseParam_t("s1" , "s", false, ParamType_E::String_E, &s1, "一个字符串参数"),
        ParseParam_t("s2" , "ws", false, ParamType_E::String_E, &s2, "一个字符串参数"),
    };

    //3.
    if (!parseParam(args, argNum, params))
    {
        printCmd(params, "命令解析测试");
        return 0;
    }

    //4. 打印所有值。接下来就可以直接使用fa、fn、s1、s2
    LogInfo("下面是最终解析结果:\na  = {}\nb  = {}\ns1 = {}\ns2 = {}", fa, fn, s1, s2);
    return 1;
}